$(function() {
    $("#qouteSourceTable").bootstrapTable('destroy').bootstrapTable({
        url : window.portAddress + "/rate/rateList",
        dataType : "json",
        method : 'get',
        striped: true,  //行间隔色
        cache : false,  //禁用缓存
        pageNumber: 1,  //初始化加载第一页
        pagination: true,//是否分页
        sidePagination: "client",//前端分页
        pageSize: 5,//单页记录数
        pageList: [5, 10, 15],//可选择单页记录数
        clickToSelect : true,
        theadClasses: "thead-pink",
        queryParams: function (params) {
            //向服务器传递的参数
            return {
               /* option : $("#search_option option:selected").val(),*/
                currency : $("#currency").val(),
                buySell : $("#buySell").val(),
            };
        },
        responseHandler : function(res) {
            return res.data;
        },
        columns : [
            {
                title : "货币种类",
                field : "currency",
                align : "center",
            },
            {
                title : "汇率",
                field : "rate",
                align : "center",
            },
            {
                title : "买卖方向",
                field : "buySell",
                align : "center",
            }

        ]
    });

    $("#search").click(function() {
        $.ajax({
            url : window.portAddress + "/rate/rateList",
            type : "post",
            data : {
                currency : $("#currency").val(),
                buySell : $("#buySell").val(),
            },
            dataType : "json",
            success : function(data) {
                if (data.state === '000000') {
                    toastr.success("查询数据成功");
                }else {
                    toastr.error(data.message);
                }
                $("#qouteSourceTable").bootstrapTable("refresh");
            }
        })
    });

})
